package com.rw.coco.api;

import com.rw.coco.Coco;
import com.rw.coco.event.MiraiPrivateMessageEvent;
import com.rw.coco.event.MiraiTempMessageEvent;
import net.mamoe.mirai.event.GlobalEventChannel;
import net.mamoe.mirai.event.events.FriendMessageEvent;
import net.mamoe.mirai.event.events.GroupTempMessageEvent;

public class MiraiPrivateMessageHandler {
    public static void onEnable(Coco coco) {
        GlobalEventChannel.INSTANCE.subscribeAlways(FriendMessageEvent.class, event -> {
            coco.getMessageHandler().handle(new MiraiPrivateMessageEvent(event));
        });

        GlobalEventChannel.INSTANCE.subscribeAlways(GroupTempMessageEvent.class, event -> {
            coco.getMessageHandler().handle(new MiraiTempMessageEvent(event));
        });
    }
}
